import request from '@/utils/request'

//获取角色列表
export const reqRoleList = (page, limit, roleName) => {
  return request.get(`/admin/acl/role/${page}/${limit}`, {
    params: {
      roleName
    }
  })
};


// export const getRoleListApi = (page: number, limit: number, roleName: string) => {
//   return request.get < any, RolePageListModel > (Api.GetRoleList + `/${page}/${limit}`, {
//     params: {
//       roleName
//     }
//   });
// };


//添加和修改角色
export const reqAddorUpdateRole = (role) => {
  if (role.id) {
    return request({
      url: '/admin/acl/role/update',
      method: 'put',
      data: role
    })
  } else {
    return request({
      url: '/admin/acl/role/save',
      method: 'post',
      data: role
    })
  }
}

//删除角色
export const reqDeleteRole = (id) => request({
  url: `/admin/acl/role/remove/${id}`,
  method: 'delete'
})


//批量删除用户
export const reqDeleteRoles = (idList) => request({
  url: `/admin/acl/role/batchRemove`,
  method: 'post',
  data: idList
})